﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Manage/TeacherMasterPage.master" AutoEventWireup="true" CodeFile="exams.aspx.cs" Inherits="Manage_exams" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style>
#chart-modal-content{display:none;}
</style>
<!--[if IE]>
<script language="javascript" type="text/javascript" src="../js/jquery/jqplot/excanvas.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="../js/jquery/jqplot/jquery.jqplot.min.css" />
<script class="include" type="text/javascript" src="../js/jquery/jqplot/jquery.jqplot.min.js"></script>
<script class="include" type="text/javascript" src="../js/jquery/jqplot/jqplot.barRenderer.min.js"></script>
<%--<script class="include" type="text/javascript" src="../js/jquery/jqplot/jqplot.pieRenderer.min.js"></script>--%>
<script class="include" type="text/javascript" src="../js/jquery/jqplot/jqplot.categoryAxisRenderer.min.js"></script>
<script class="include" type="text/javascript" src="../js/jquery/jqplot/jqplot.pointLabels.min.js"></script>


<script>
$(document).ready(function(){
    $.jqplot.config.enablePlugins = true;
   
});

function getBar(id,_title) {
    $('#chart-modal-content').modal({
        opacity: 55, zIndex: 10,
        onOpen: function (dialog) {
            dialog.overlay.fadeIn('fast', function () {
                dialog.data.hide();
                dialog.container.fadeIn('fast', function () {
                    dialog.data.show(); //slideDown('slow');
                    $("#examtitle").html(_title);
                    DrawBar(id); plot1.replot();
                });
            });
        }
    });
    
    return false;

}
var plot1;
function DrawBar(id) {
    //$.jqplot.config.enablePlugins = true;
    var arr;

    $.ajax({
        type: "get",
        cache: false,async: false,
        url: "Service/getexamscore.aspx?id=" + id,
        beforeSend: function () {
            $("#status").html("&nbsp;<img src='../images/loading16x16.gif' border=0 style='vertical-align:middle;' /><%= Resources.labels.PleaseWaiting%>").show();
        },
        success: function (msg) {
            if (msg != "") {
                $("#status").html("&nbsp;<img src='../images/ok.png' border=0 style='vertical-align:middle;' /><%= Resources.labels.Operate_OK%>").css("color", "#066606");
                arr = msg.split('|'); 
            } else {
                $("#status").html("&nbsp;<img src='../images/erro.png' border=0 style='vertical-align:middle;' /><%= Resources.labels.GetInfoFail%>").css("color", "#FF0000");
            }
        },
        error: function (msg) {
            $("#status").html("&nbsp;<img src='../images/erro.png' border=0 style='vertical-align:middle;' /><%= Resources.labels.GetInfoFail%>").css("color", "#FF0000");
        }
    });

    var s1 = arr[0].split(','); //[2, 6, 7, 10];
    var ticks = arr[1].split(','); //['a', 'b', 'c', 'd'];

    plot1 = $.jqplot('chart1', [s1], {
        // Only animate if we're not using excanvas (not in IE 7 or IE 8)..
        animate: !$.jqplot.use_excanvas,
        seriesDefaults: {
            renderer: $.jqplot.BarRenderer,
            pointLabels: { show: true }
        },
        axes: {
            xaxis: {
                renderer: $.jqplot.CategoryAxisRenderer,
                ticks: ticks
            }
        },
        highlighter: { show: false }
    });

    $('#chart1').bind('jqplotDataClick',
    function (ev, seriesIndex, pointIndex, data) {
        $('#info1').html('series: ' + seriesIndex + ', point: ' + pointIndex + ', data: ' + data);
    });
}
</script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <table class="grid" border="0" cellspacing="0" cellpadding="0" width="100%">
        <thead>
            <tr>
                <th><%= Resources.labels.fineshExam%></th>
                <th></th>
            </tr>
        </thead>
        <tbody>
        <asp:Repeater ID="rp" runat="server" EnableViewState=false 
                onitemdatabound="rp_ItemDataBound">
        <ItemTemplate>
            <tr>
                <td>
                <a href='currexam.aspx?id=<%# Eval("PaperId")%>' target=_blank><%# Eval("PaperName")%></a>
                <div style="width:90%;HEIGHT:100%;font-size:0.9em; color:#A3A3A3;margin-left:20px;margin-top:5px;">
                        <asp:Literal ID="litTj" runat="server"></asp:Literal>
                    </div>
                </td>
                <td width=10%>
                <a href="javascript:void(0);" class="button" title="" style="display:none;" onclick="getBar('<%# Eval("PaperId")%>','<%# Eval("PaperName")%>')">图表</a>
                </td>
            </tr>
        </ItemTemplate>
        </asp:Repeater>    
        </tbody>
    </table>


<div  id="chart-modal-content">
<div style="display:none;"><span id="examtitle"></span>:<span id="info1"></span></div>
<div id="chart1" style="width:600px; height:330px;"></div>
</div> 


</asp:Content>

